<?php 
class IndexController extends Controller{
	//保存数据库路径
	private $path;
	//保存数据库信息
	public $db;
	public function __construct(){
		$this->path = ROOT_PATH . '/data.php';
		$this->db = include $this->path;
	}
	public function index(){
		$this->assign('db', $this->db);
		$this->display();
	}
	public function ajax_add(){
		$_POST['time'] = date('Y-m-d');
		$this->db[] = $_POST;
		data_to_file($this->db, $this->path);
		echo json_encode($_POST);
	}
}
?>